<?php

/**
 * PP form base class.
 *
 * @method PP getObject() Returns the current form's model object
 *
 * @package    Porba
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePPForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'order_id'   => new sfWidgetFormInputHidden(),
      'ItemNr'     => new sfWidgetFormInputHidden(),
      'name'       => new sfWidgetFormInputHidden(),
      'type'       => new sfWidgetFormInputHidden(),
      'amount'     => new sfWidgetFormInputText(),
      'price'      => new sfWidgetFormInputText(),
      'VAT'        => new sfWidgetFormInputText(),
      'discount'   => new sfWidgetFormInputText(),
      'TotalPrice' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'order_id'   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('order_id')), 'empty_value' => $this->getObject()->get('order_id'), 'required' => false)),
      'ItemNr'     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('ItemNr')), 'empty_value' => $this->getObject()->get('ItemNr'), 'required' => false)),
      'name'       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('name')), 'empty_value' => $this->getObject()->get('name'), 'required' => false)),
      'type'       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('type')), 'empty_value' => $this->getObject()->get('type'), 'required' => false)),
      'amount'     => new sfValidatorInteger(),
      'price'      => new sfValidatorString(array('max_length' => 255)),
      'VAT'        => new sfValidatorString(array('max_length' => 255)),
      'discount'   => new sfValidatorString(array('max_length' => 255)),
      'TotalPrice' => new sfValidatorString(array('max_length' => 255)),
    ));

    $this->widgetSchema->setNameFormat('pp[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PP';
  }

}
